package blog.util.database;


public class DatabaseContextHolder {
    public static final String DATA_SOURCE_BLOG = "blogDataSource";
    public static final String DATA_SOURCE_COMMON = "commonDataSource";
    private static final ThreadLocal<String> DATA_SOURCE = new ThreadLocal<>();

    public static void setDataSource(String dataSource) {
        DATA_SOURCE.set(dataSource);
    }

    //获取数据源
    public static String getDataSource() {
        return DATA_SOURCE.get();
    }

    //清除数据源，使用默认的数据源
    public static void resetDefaultDataSource() {
        DATA_SOURCE.remove();
    }
}